package com.xin.service.impl;

import com.xin.dao.UserDao;
import com.xin.dao.impl.UserDaoimpl;
import com.xin.pojo.User;
import com.xin.service.UserService;

public class UserServiceimpl implements UserService {
    private UserDao userDao=new UserDaoimpl();
    @Override
    public void registUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public User login(User user) {
        return userDao.queryUserByUsernameandPassword(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean existsUsername(String username) {
        return userDao.queryUserByUsername(username)!=null;
    }
}
